package com.hex.ds.hdtp.core.app.common.util;

import com.hex.ds.hdtp.core.inf.common.constant.CoreConst;
import com.hex.ds.hdtp.core.inf.metadata.po.SourceConfInfoPo;

import java.util.List;

public class SourceMethodUtil {

    public static void replacePlaceholder(List<SourceConfInfoPo> confInfoList){
        for (SourceConfInfoPo sourceConfInfo1 : confInfoList){
            for (SourceConfInfoPo sourceConfInfo2 : confInfoList){
               if (CoreConst.YES.equals(sourceConfInfo1.getIsPlaceholderAttribute())
                       && sourceConfInfo1.getPlaceholderConfName().equals(sourceConfInfo2.getConfName())){
                   String oldChar = "${" + sourceConfInfo1.getConfName() + "}";
                   sourceConfInfo2.setConfValue(sourceConfInfo2.getConfValue().replace(oldChar, sourceConfInfo1.getConfValue()));
               }
            }
        }
    }
}
